#!/usr/bin/env bash
# Copyright (c) 2021 The Toltec Contributors
# SPDX-License-Identifier: MIT

pkgnames=(fingerterm)
pkgdesc="Terminal emulator with an on-screen touch keyboard"
url=https://github.com/dixonary/fingerterm-reMarkable
pkgver=1.3.5-15
timestamp=2020-10-27T12:02Z
section="admin"
maintainer="Mattéo Delabre <spam@delab.re>"
license=GPL-2.0-or-later
installdepends=(display)
flags=(patch_rm2fb)

image=qt:v2.1
source=(
    https://github.com/dixonary/fingerterm-reMarkable/archive/02c17b5b485743c698e005ca89366c32b66aa044.zip
    fingerterm.png
    fingerterm.draft
)
sha256sums=(
    1e2290f876ca97dceda5b25e04517d793ac0a040fa4d6004dd34e5b507de534c
    SKIP
    SKIP
)

build() {
    sed -i 's,DEPLOYMENT_PATH = /usr,DEPLOYMENT_PATH = /opt,' fingerterm.pro
    qmake fingerterm.pro
    make
}

package() {
    install -D -m 755 -t "$pkgdir"/opt/bin "$srcdir"/fingerterm

    install -d "$pkgdir"/opt/share/fingerterm
    install -D -m 644 -t "$pkgdir"/opt/share/fingerterm "$srcdir"/qml/*
    cp -r "$srcdir"/icons "$pkgdir"/opt/share/fingerterm
    cp -r "$srcdir"/data "$pkgdir"/opt/share/fingerterm

    install -D -m 644 -t "$pkgdir"/opt/etc/draft "$srcdir"/fingerterm.draft
    install -D -m 644 -t "$pkgdir"/opt/etc/draft/icons "$srcdir"/fingerterm.png
}
